/** 
 * FileName:     Purchase.java 
 * @Description: TODO(用一句话描述该文件做什么) 
* All rights Reserved, Designed By hnkeystone 
 * Copyright:    Copyright(C) 2010-2011 
 * Company       坚磐科技 
 * @author:    冯辉 
 * @version    V1.0  
 * Createdate:         2017-3-29 下午6:12:08 
 * 
 * Modification  History: 
 * Date         Author        Version        Discription 
 * ----------------------------------------------------------------------------------- 
 * 2017-3-29       hnkeystone.com          1.0             1.0 
 * Why & What is modified: <修改原因描述> 
 */  
package com.fh.controller.purchase;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.fh.controller.base.BaseController;
import com.fh.entity.Page;
import com.fh.util.PageData;

/** 
 * @ClassName:     Purchase 
 * @Description:TODO(这里用一句话描述这个类的作用) 
 * @author:    冯辉 
 * @date:        2017-3-29 下午6:12:08 
 *  
 */
@Controller
@RequestMapping(value = "/purchase")
public class Purchase extends BaseController {
	/**
	 * 预警商品
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/inventorywarning")
	public ModelAndView auditsetting()throws Exception{
		ModelAndView mv = this.getModelAndView();
		mv.setViewName("purchase/inventorywarning");
		return mv;
	}
	/**
	 * 预警商品列表
	 * @param request
	 * @param page
	 * @param rows
	 * @param session
	 * @return
	 */
		@RequestMapping(value="/queryGoodsList")
		@ResponseBody
		public Object querySendOrderList(HttpServletRequest request,int page,int rows,HttpSession session) throws Exception{
			String goodsNo=request.getParameter("goodsId");//商品编号
			String goodsName=request.getParameter("name");//商品名字
			String goodsType=request.getParameter("goodsType");//商品小类
			String startTime=request.getParameter("startTime");//开始时间
			String endTime=request.getParameter("endTime");//结束时间
			//SupplierEntity user=(SupplierEntity) session.getAttribute(Constant.SESSION_USER);
				//分页对象
				Page pd = new Page();
				//设置参数
				PageData pda = new PageData();
				pda.put("goodsId", goodsNo);
				pda.put("name", goodsName);
				pda.put("goodsType",goodsType);
				pda.put("startTime", startTime);
				pda.put("endTime", endTime);
				//pda.put("id", user.getSupplierId());
				pd.setPd(pda);
				//商品预警总条数
			  // int totalCount=goodService.querygoodCount(pd);
				//pd.setPageParams(totalCount, rows, page);
				//订单列表
				//List<GoodsEntity> list=goodService.querygoodsList(pd);
				//把结果集和总条数返回
			    Map<String,Object> map=new HashMap<String,Object>();
			   // map.put("total", totalCount);
			   // map.put("rows", list);
				return map;
		}
	/**
	 * 采购到货
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/purchasearrival")
	public ModelAndView purchasearrival()throws Exception{
		ModelAndView mv = this.getModelAndView();
		mv.setViewName("purchase/purchasearrival");
		return mv;
	}
	/**
	 * 采购到货列表
	 * @param request
	 * @param page
	 * @param rows
	 * @return
	 */
		@RequestMapping(value="/purchaseList")
		@ResponseBody
		public Object querySureOrderList(HttpServletRequest request,int page,int rows) throws Exception{
			String goodsNo=request.getParameter("goodsNo");//商品编号
			String name=request.getParameter("name");//商品名字
			String goodsType=request.getParameter("goodsType");//商品小类
			String startTime=request.getParameter("startTime");//开始时间
			String endTime=request.getParameter("endTime");//结束时间
			
				//分页对象
				Page pd = new Page();
				//订单总条数
			    //int totalCount=goodService.goodPurchaseCount(pd);
				//pd.setPageParams(totalCount, rows, page);
				//设置参数
				PageData pda = new PageData();
				pda.put("goodsNo", goodsNo);
				pda.put("name", name);
				pda.put("goodsType", goodsType);
				pda.put("startTime", startTime);
				pda.put("endTime", endTime);
				pd.setPd(pda);
				//订单列表
				//List<GoodsEntity> list=goodService.goodPurchaseList(pd);
				//把结果集和总条数返回
			    Map<String,Object> map=new HashMap<String,Object>();
			   // map.put("total", totalCount);
			   // map.put("rows", list);
			    
				return map;
		}
}
